//
//  Segment.h
//  NewsMaker Touch
//
//  Created by Reisen on 9/23/14.
//  Copyright (c) 2014 Reisen. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "PreviewView.h"
#import "VideoRecorder.h"

#define SCALE_FACTOR 640.0f/768.0f

enum SegmentType { SegmentTypeTrailer, SegmentTypeWebcam, SegmentTypeVoiceImage, SegmentTypeVoiceVideo, SegmentTypeTextInsert, SegmentTypeVideoInsert };

@interface Segment : NSObject
{
    VideoRecorder* recorder;
    UIView* layoutView;
}

@property (strong) NSString* name;
@property (assign) NSInteger type;
@property (strong) NSString* actor;
@property (strong) NSString* note;
@property (strong) NSDate* lastModified;

@property (strong) NSString* storageFolder;
@property (strong) NSString* root;
@property (strong) NSString* fileRoot;
@property (weak) PreviewView* currentPreviewLayer;

@property (assign) float progress;

@property (assign) SEL encodingCompleted;
@property (assign) id encodingDelegate;

-(id)initWithDictionary:(NSDictionary*)dict;
-(NSMutableDictionary*)dictionaryRepresentation;

-(void)save;
-(void)load;
-(NSString*)fullPath;

-(void)initializePreview;
-(void)play;
-(void)pause;
-(void)stop;

-(BOOL)canPreview;

-(UIColor*)colorCode;

-(void) encodeVideo;
-(CGFloat)seekToTime:(float)gap;
-(void) initializePreviewInView:(UIView*)layoutView;

-(NSString*)videoInformation;
-(NSMutableArray*)audioInformationWithStart:(float)start;

-(float)getDuration;

-(void)loadBackgroundInView:(UIView*)view fromDict:(NSDictionary*)dict;
@end
